package com.jxtest.studykafka.kafkatest;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;

/**
 * @description: caClient
 * @author: Jiax
 * @time: 2021/7/7 10:29
 */
public class caClient {
    public static void main(String[] args) {
        try {
            String endpoint = "http://127.0.0.1:8080/UserServiceImpi/dao?wsdl";
            // 直接引用远程的wsdl文件
            // 以下都是套路
            Service service = new Service();
            Call call = (Call) service.createCall();
            call.setTargetEndpointAddress(endpoint);
            call.setOperationName("getUserByName");// WSDL里面描述的接口名称
            call.addParameter("username",
                    org.apache.axis.encoding.XMLType.XSD_STRING,
                    javax.xml.rpc.ParameterMode.IN);// 接口的参数
            call.addParameter("userpwd",
                    org.apache.axis.encoding.XMLType.XSD_STRING,
                    javax.xml.rpc.ParameterMode.IN);// 接口的参数
            call.addParameter("usertype",
                    org.apache.axis.encoding.XMLType.XSD_STRING,
                    javax.xml.rpc.ParameterMode.IN);// 接口的参数

            call.setReturnType(XMLType.XSD_INT);// 设置返回类型
            //String[] temp = {"张三","123456","01"};
            Integer result = (Integer) call.invoke(new Object[] {"张三","123456","01"});
            // 给方法传递参数，并且调用方法
            System.out.println("result is " + result);
        } catch (Exception e) {
            System.err.println(e.toString());
        }
    }
}
